//
//  LabelSettingViewController.m
//  collection-proto3
//
//  Created by Robert England on 10/24/10.
//  Copyright 2010 Transylvania University. All rights reserved.
//

#import "LabelSettingViewController.h"


@implementation LabelSettingViewController

//RE::24Oct2010
@synthesize	value;

-(id)init {
	[super initWithNibName:nil bundle:nil];
	[self setTitle:@"New Record"];
	
	// set up navigation stuff
	UIBarButtonItem *bbi;
	
	// 'done' item
	bbi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
														target:self
														action:@selector(create:)];
	[[self navigationItem] setRightBarButtonItem:bbi];
	[bbi release];

	// cancel item
	bbi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
														target:self
														action:@selector(cancel:)];
	[[self navigationItem] setLeftBarButtonItem:bbi];
	[bbi release];
	
	return self;
}

// override the superclass's designated initializer
-(id)initWithNibName:(NSString *)n bundle:(NSBundle *)b {
	return [self init];
}



//::RE
/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/

//RE::24Oct2010
#pragma mark View Controller Life Cycle
//::RE

/**/
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	//RE::24Oct2010
	[textField setAutocorrectionType:UITextAutocorrectionTypeNo];
	//::RE
}
/**/

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
	//RE::24Oct2010
	[textField release];
	textField = nil;
	//::RE
}

//RE::24Oct2010
-(void)viewDidAppear:(BOOL)animated {
	[super viewDidAppear:animated];
	
	// make the keyboard appear
	[textField becomeFirstResponder];
}
//::RE

//RE::
#pragma mark Actions

-(IBAction)cancel:(id)sender {
	// clear the value
	[self setValue:nil];
	
	// slide back to the previous view controller
	[[self navigationController] popViewControllerAnimated:YES];
}

-(IBAction)create:(id)sender {
	// set the value
	[self setValue:[textField text]];
	
	// slide back to the previous view controller
	[[self navigationController] popViewControllerAnimated:YES];
}

//::RE
	
	
- (void)dealloc {
	//RE::24Oct2010
	[textField release];
	[value release];
	//::RE
    [super dealloc];
}


@end
